﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Model
{
    [Table("Product")]
    public class Product
    {
        private int _productId;
        private int _flowId;
        private int _stationId;
        private int _totalProcessId;
        private int _materialId;
        private string _entryAndExitStatus;
        private string _productDescription;
        private string _productType;
        private string _unit;
        private string _packagingForm;

        // 产品 ID（主键）
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ProductId
        {
            set { _productId = value; }
            get { return _productId; }
        }

        [Required]
        public int FlowId
        {
            set { _flowId = value; }
            get { return _flowId; }
        }

        [Required]
        public int StationId
        {
            set { _stationId = value; }
            get { return _stationId; }
        }

        // 总流程 ID（外键，非空）
        [Required]
        public int TotalProcessId
        {
            set { _totalProcessId = value; }
            get { return _totalProcessId; }
        }

        // 物料 ID（外键，非空）
        [Required]
        public int MaterialId
        {
            set { _materialId = value; }
            get { return _materialId; }
        }
        //cs
        [Required]
        [StringLength(255)]
        public string EntryAndExitStatus
        {
            set { _entryAndExitStatus = value; }
            get { return _entryAndExitStatus; }
        }

        [Required]
        [StringLength(255)]
        // 产品说明（可空）
        public string ProductDescription
        {
            set { _productDescription = value; }
            get { return _productDescription; }
        }

        // 产品类型（非空）
        [Required]
        [StringLength(255)]
        public string ProductType
        {
            set { _productType = value; }
            get { return _productType; }
        }

        // 单位（非空）
        [Required]
        [StringLength(255)]
        public string Unit
        {
            set { _unit = value; }
            get { return _unit; }
        }

        // 封装形式（非空）
        [Required]
        [StringLength(255)]
        public string PackagingForm
        {
            set { _packagingForm = value; }
            get { return _packagingForm; }
        }

        // 构造函数
        public Product()
        {
            // 可以在构造函数中初始化一些默认值
        }
    }
}